package com.ourygo.fileselect.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.ourygo.fileselect.MainActivity;
import com.ourygo.fileselect.R;
import com.ourygo.fileselect.bean.Files;

import java.io.File;
import java.util.List;

public class FileSelectListRecyclerViewAdapter extends
		BaseQuickAdapter<Files, BaseViewHolder>// RecyclerView
		// .Adapter<FileSelectListRecyclerViewAdapter.ViewHolder>
{
	private List<Files> data;
	private MainActivity context;

	public FileSelectListRecyclerViewAdapter(MainActivity context, List<Files> data) {
		super(R.layout.file_select_list_recycl_item, data);
		this.context = context;
		this.data = data;
	}

	@Override
	protected void convert(BaseViewHolder helper, final Files item) {
		helper.setText(R.id.tv_name, item.getName());
	}

	public void remove(Files f) {
		for (int i = 0; i < data.size(); i++) {
			if (data.get(i).getAbsolutePath().equals(f.getAbsolutePath())) {
				removeAt(i);
				return;
			}
		}
	}
}
